INSTALL_DIR = /usr/local/include/objectdraw
INSTALL_LIB_DIR = /usr/local/lib

TARGET_LIB = libobjdraw++.a

OBJS = 	src/Object.o \
		src/GraphicsInstance.o \
		src/Color.o \
		src/Location.o \
		src/KeyListener.o \
		src/CanvasManager.o \
		src/DrawingCanvas.o \
		src/DrawableInterface.o \
		src/Drawable1DInterface.o \
		src/Drawable2DInterface.o \
		src/Resizable2DInterface.o \
		src/Line.o \
		src/FilledRect.o \
		src/FramedRect.o \
		src/Font.o \
		src/Text.o \
		src/Image.o \
		src/Sprite.o \
		src/AnimSprite.o \
		src/imageutil/ImageUtil.o \
		src/imageutil/ImageUtil_convertImageTo.o \
		src/imageutil/ImageUtil_png.o 

INCDIR =  
CFLAGS = -O2 -G0 -Wall -g 
CXXFLAGS = $(CFLAGS) -fexceptions -frtti
ASFLAGS = $(CFLAGS)

INCS = -I./header 

CFLAGS := $(INCS) 

LIBDIR =
LDFLAGS =

LIBS = `sdl-config --cflags --libs` -lglut -lGLU -lGL -lpng -lz -lstdc++ -lm

%.o : %.cpp
	${CXX} -c ${CXXFLAGS} ${INCS} $< -o $@

%.o : %.c
	${CC} -c ${CFLAGS} ${INCS} $< -o $@
	
$(TARGET_LIB) : $(OBJS)
	$(AR) cru $@ $(OBJS)
	$(RANLIB) $@ 
	
all : $(TARGET_LIB)
	
clean:
	$(RM) -rf $(OBJS) $(TARGET_LIB)
	
install: all
	@mkdir -p $(INSTALL_DIR)
	cp -f header/CanvasManager.h $(INSTALL_DIR)
	cp -f header/Color.h $(INSTALL_DIR)
	cp -f header/Drawable1DInterface.h $(INSTALL_DIR)
	cp -f header/Drawable2DInterface.h $(INSTALL_DIR)
	cp -f header/DrawableInterface.h $(INSTALL_DIR)
	cp -f header/DrawingCanvas.h $(INSTALL_DIR)
	cp -f header/FilledRect.h $(INSTALL_DIR)
	cp -f header/Font.h $(INSTALL_DIR)
	cp -f header/FramedRect.h $(INSTALL_DIR)
	cp -f header/GraphicsInstance.h $(INSTALL_DIR)
	cp -f header/Image.h $(INSTALL_DIR)
	cp -f header/ImageUtil.h $(INSTALL_DIR)
	cp -f header/KeyListener.h $(INSTALL_DIR)
	cp -f header/Line.h $(INSTALL_DIR)
	cp -f header/Location.h $(INSTALL_DIR)
	cp -f header/objdraw.h $(INSTALL_DIR)
	cp -f header/Object.h $(INSTALL_DIR)
	cp -f header/Resizable2DInterface.h $(INSTALL_DIR)
	cp -f header/Sprite.h $(INSTALL_DIR)
	cp -f header/AnimSprite.h $(INSTALL_DIR)
	cp -f header/Text.h $(INSTALL_DIR)
	cp -f header/Types.h $(INSTALL_DIR)
	@cd ..
	@mkdir -p $(INSTALL_LIB_DIR)
	cp -f $(TARGET_LIB) $(INSTALL_LIB_DIR)
	@echo
	@echo "** Headerfiles installed in $(INSTALL_DIR)"
	@echo "** Library files installed in $(INSTALL_LIB_DIR)"
